package com.situ.ymall.admin.controller;


import com.github.pagehelper.PageInfo;
import com.situ.ymall.admin.entity.APIResult;
import com.situ.ymall.admin.entity.Order;
import com.situ.ymall.admin.service.OrderService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/orders")
@CrossOrigin(origins = {"*"})
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping
    public APIResult getAll(Integer page , Integer limit){
        System.err.println("111111111111111111111111111111111");
        PageInfo pageInfo = orderService.getAll(page,limit);


       return APIResult.ok(pageInfo);
    }

    @DeleteMapping
    public APIResult remove(Integer id){
        Order order = orderService.remove(id);
        return APIResult.ok(order);
    }

}
